<?php
function dump($expression)
{
	echo "<pre>";
	var_dump($expression);
}

function export($expression)
{
	echo "<pre>";
	var_export($expression);
}

function getEditor($instance, $value='', $width='100%', $height='500px', $toolbarset='Default')
{
	require_once ROOT_DIR . '/fckeditor/fckeditor.php';
	$fckObj = new FCKeditor($instance);
	$fckObj->Width = $width;
	$fckObj->Height = $height;
	$fckObj->ToolbarSet = $toolbarset;
	$fckObj->Value = $value;
	$fckObj->BasePath = ROOT_PATH . 'fckeditor/';
	$fckObj->Config['baseDir'] = '';
	return $fckObj->CreateHtml();
}

function fetchArchives($id)
{
	require_once ROOT_DIR . 'module/Catalog.php';
	require_once ROOT_DIR . 'module/Archives.php';
	require_once ROOT_DIR . 'module/Tags.php';
	global $config;
	$modTags = new Tags();
	$modCatalog = new Catalog();
	$modArchives = new Archives();
	$tpl = new Template();
	$tags = $modTags->getTags();
	$archives = $modArchives->getArchivesById($id);
	$tpl->assign('tags', $tags);
	$tpl->assign('config', $config);
	$tpl->assign('archives', $archives);
	return $tpl->fetch('archives-display.html');
}

function getArchivesFileName($archives, &$fileDir)
{
	$fileName = isset($archives['filename'])&&!empty($archives['filename'])
				? $archives['filename']
				: date('YmdHis', $archives['pubdate']);
	$fileDir = ROOT_DIR . 'archives/' . $fileName;
	return ROOT_PATH . 'archives/' . $fileName;
}

function replaceCode($content)
{
	
}


